package com.njtoyo.taxi.admin.rest.controller.open;


import com.njtoyo.taxi.admin.aop.PassToken;
import com.njtoyo.taxi.admin.mapper.secondary.entity.ICBCBill;
import com.njtoyo.taxi.admin.mapper.secondary.entity.RefundWrapper;
import com.njtoyo.taxi.admin.service.open.BankService;
import com.taxi.entity.common.RestResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 银行相关的
 */
@RestController
@RequestMapping("open/bank")
@Slf4j
public class BankController {
    @Autowired
    private BankService bankService;



    @PostMapping("/icbc/save-bill")
    @PassToken
    public RestResult saveICBCBill(@RequestBody ICBCBill wrapper) {
        return bankService.saveICBCBill(wrapper);
    }


    @PostMapping("/cmb/callback")
    @PassToken
    public RestResult cmbCallback(@RequestBody Map<String, Object> params) {
        log.info("招商银行接收通知：{}", params);
        return bankService.cmbCallback(params);

    }

    @PostMapping("/refund")
    @PassToken
    public RestResult refundOrder(@RequestBody RefundWrapper refundWrapper) {
        log.info("退款请求参数：{}", refundWrapper);
        return bankService.refundOrder(refundWrapper);
    }

}
